package cn.tedu.coolshark12.mapper;

import cn.tedu.coolshark12.entity.Banner;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BannerMapper {

    //查询轮播图
    @Select("select * from banner")
    List<Banner> select();

    //删除轮播图
    @Delete("delete from banner where id =#{id}")
    void deleteById(int id);

    //通过ID 查询轮播图url的名字
    @Select("select url from banner where id =#{id}")
    String selectUrlById(int id);

    //添加轮播图
    @Insert("insert into banner values(null,#{url})")
    void insert(Banner banner);
}












   /*     select u.name from user u join u_r ur on u.id=ur.uid join role r on ur.rid=r.id where r.name="女会员";
        select m.name from module m join r_m rm on m.id=rm.mid join role r on r.id=rm.rid where r.name="男游客";
        select m.name from module m join r_m rm on m.id=rm.mid join role r on r.id=rm.rid where r.name="女会员";
        select m.name from  user u join u_r ur on u.id=ur.uid join r_m rm on ur.rid=rm.rid join module m on rm.mid=m.id where u.name="刘德华";

        select from user u join r_m rm on u.id = rm.uid moudle m join r_m rm on m.id =rm.mid where u.name="刘德华";select r.name from u_r  join user u on u_r.uid=u.id join role r on u_r.rid=r.id where u.name="刘德华";*/